﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DTO;
namespace DAO
{
    public class DatBanDAO
    {
        public static DataTable ListDatBan()
        {
            string sql = string.Format("select * from DATBAN where TINHTRANG=1");
            return DataProvider.ExcuteQuery(sql);
        }
        public static int Datban(DatBanDTO db)
        {
            string sql = string.Format("insert into DATBAN(TENKH,SODIENTHOAI,NGAY,GIO,SOLUONG,TINHTRANG) values('{0}','{1}','{2}','{3}','{4}','{5}')", db.TenKH, db.SDT, db.Ngay, db.Gio, db.Soluong, db.Tinhtrang);
            return DataProvider.ExcuteNonQuery(sql);
        }
        public static int Huy(int madb)
        {
            string sql = string.Format("Update DATBAN set TINHTRANG=0 WHERE MADATBAN={0}", madb);
            return DataProvider.ExcuteNonQuery(sql);

        }
    }
}
